<%--
  Created by IntelliJ IDEA.
  User: 97809
  Date: 2022-1-4
  Time: 17:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Ajax测试</title>
    <%--    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>--%>
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.6.0.js"></script>

    <script>
        function a1() {
            $.post({
                url: "${pageContext.request.contextPath}/ajax/a1",
                data: {'name': $("#txtName").val()},
                success: function (data, status) {
                    alert(data);
                    alert(status);
                    console.log(data);
                    console.log(status);
                }
            });
        }
    </script>
</head>
<body>
<%--onblur：失去焦点触发事件--%>
用户名:<label for="txtName"><input type="text" id="txtName" onblur="a1()"/></label>
</body>
</html>
